<template>
	<view class='authorization flex flex-direction justify-center align-center bg-white'>
	  <text class='text-sl text-red'>全球建面欢迎你</text>
		<button class='cu-btn bg-red lg' v-if="canIUse" open-type="getUserInfo" bindgetuserinfo="getUserInfo">开启你的健身之旅</button>
	</view>
</template>

<script>
	export default {
		data() {
		  return {
				canIUse: wx.canIUse('button.open-type.getUserInfo')
			}
		},
		methods: {
			getUserInfo: function (e) {
				console.log(e)
				if (e.detail.userInfo) {
					const obj = {}
					Object.assign(obj, app.globalData, e.detail)
					app.globalData = obj
					uni.redirectTo({
							url: '/pages/index/index'
					});
				}
			}
		}
	}
</script>

<style lang="scss">
	.authorization{
		height: 100vh;
		.cu-btn{
			margin-top: 60vh;
		}
	}
</style>
